<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>合众人寿公益平台客户管理系统</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<link href="<%=request.getContextPath()%>/html/css/Main.css"
			rel="stylesheet" type="text/css" />
		<script src="<%=request.getContextPath()%>/html/js/Calendar.js"
			charset="utf-8"></script>
			
			 <!-- Dwr Js -->
		<script
			src="<%= request.getContextPath() %>/dwr/interface/organizationAction.js"
			type="text/javascript"></script>
		<script src="<%= request.getContextPath() %>/dwr/engine.js"
			type="text/javascript"></script>
		<script src="<%= request.getContextPath() %>/dwr/util.js"
			type="text/javascript"></script>
		<script src="<%= request.getContextPath() %>/html/js/subCityUtil.js"
			type="text/javascript"></script>

		<style>
body,ul,ol,dl,dd,p,h1,h2,h3,h4,h5,h6,form,input,textarea,select,td,th {
	margin: 0;
	padding: 0;
	font-family: "宋体", Arial, Helvetica, sans-serif;
}

li {
	list-style: none;
}

input {
	background: none;
}

.clear {
	zoom: 1;
}

.clear:after {
	content: "";
	display: block;
	clear: both;
}
td input{
width:200px;
}
</style>


		<SCRIPT type="text/javascript">
     function check(){
     	if(document.getElementById("activityDate").value == ''){
     	   alert("请输入活动日期!");
     	   return false;
     	}
     	if(document.getElementById("enjoyActivity").value == ''){
     	   alert("请输入专享项目!");
     	   return false;
     	}
     	if(document.getElementById("organizeFee").value == ''){
     	   alert("请输入组织经费!");
     	   return false;
     	}
     	if(document.getElementById("organizeFee").value < 0 || isNaN(document.getElementById("organizeFee").value)){
     	   alert("组织经费不合法!");
     	   return false;
     	}
     	if(document.getElementById("participantsNum").value == ''){
     	   alert("请输入参与人数!");
     	   return false;
     	} 
     	if(document.getElementById("participantsNum").value.search(/^\d+$/)== -1){
     	   alert("参与人数不合法!");
     	   return false;
     	} 
     	if(document.getElementById("activityPlace").value == ''){
     	   alert("请输入活动地点!");
     	   return false;
     	} 
     	if(document.getElementById("subCompany").value == ''){
     	   alert("请选择分公司!");
     	   return false;
     	} 
     	if(document.getElementById("subCity").value == ''){
     	   alert("请选择中支机构!");
     	   return false;
     	}
     	if(document.getElementById("participantsNum").value == ''){
     	   document.getElementById("participantsNum").value = 0;
     	} 
     	if(document.getElementById("oaSph").value == ''){
     	   alert("请输入OA审批号!");
     	   return false;
     	} 
     	document.getElementById("subComName").value = document.getElementById("subCompany").options[document.getElementById("subCompany").selectedIndex].innerText;
     	document.getElementById("subCityName").value = document.getElementById("subCity").options[document.getElementById("subCity").selectedIndex].innerText;
     	return true;
     }
     
     function ajaxSubmitCom(){
     
	     ajaxSubmit();
	     document.getElementById("subCity").options[0].innerText = "请选择中支机构";
     }
	 </SCRIPT>
	</head>
	<body>
		<div class="container">
			<div class="wrap clear">
				<div class="sub_wp_right">
					<div class="rt_tt">
						<h3 class="tittle">
							修改会员专享活动
						</h3>
					</div>
					<div class="ct">
						<form
							action="<%=request.getContextPath()%>/memberEnjoy/updatedMemberEnjoy.do"
							method="post" onsubmit="return check()">
							<div class="add">
								<table  class="viewTable">
									<tr>
										<td align="right" class="title">
											<span>活动日期<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="memberEnjoy.activityDate"
												id="activityDate" value="${memberEnjoy.activityDate}" onfocus="calendar()"/>
										</td>
										<td align="right" class="title">
											<span>专享项目<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="memberEnjoy.enjoyActivity"
												id="enjoyActivity" value="${memberEnjoy.enjoyActivity}" />
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>组织经费<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="memberEnjoy.organizeFee"
												id="organizeFee" value="${memberEnjoy.organizeFee}" />
										</td>
										<td align="right" class="title">
											<span>参与人数<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="memberEnjoy.participantsNum"
												id="participantsNum" value="${memberEnjoy.participantsNum}" />
										</td>
									</tr>
									<tr>
									<td align="right" class="title">
										<span>分公司<font color="red">(*)</font>：</span>
									</td>
									<td class="t2" >
										<select name="memberEnjoy.subCompany" id="subCompany" style="width:174px;"  onchange="ajaxSubmitCom()" >
											<s:iterator value="#session.barchList" var="organ">
												<option value="<s:property value="#organ.um_organ_id" />"
													<c:if test="${memberEnjoy.subCompany eq organ.um_organ_id }">selected</c:if>>
													<s:property value="#organ.abbr_name" />
												</option>
											</s:iterator>
										</select>
									</td>
									
									<td align="right" class="title">
										<span>中支<font color="red">(*)</font>：</span>
									</td>
									<td class="t2" >
									  <c:if test="${'THIRDADMIN' eq rolename}">
										<select name="memberEnjoy.subCity" id="subCity" style="width:174px;">
											<s:iterator value="#session.expensedList" var="organ">
												<option value="<s:property value="#organ.um_organ_id" />"
													<c:if test="${memberEnjoy.subCity eq organ.um_organ_id }">selected</c:if>>
													<s:property value="#organ.abbr_name" />
												</option>
											</s:iterator>
										</select>
										</c:if>
										<c:if test="${'THIRDADMIN' ne rolename}">
										<select name="memberEnjoy.subCity" id="subCity" style="width:174px;">
											<s:iterator value="#request.expensedCityList" var="organ">
												<option value="<s:property value="#organ.um_organ_id" />"
													<c:if test="${memberEnjoy.subCity eq organ.um_organ_id }">selected</c:if>>
													<s:property value="#organ.abbr_name" />
												</option>
											</s:iterator>
										</select>
										</c:if>
										
										<input type="hidden" value="${subCityHidden}" name="subCityHidden" />
									</td>
                              </tr>
									<tr>
										<td align="right" class="title">
											<span>活动地点<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="memberEnjoy.activityPlace"
												id="activityPlace" value="${memberEnjoy.activityPlace}" />
										</td>
										<td  align="right" class="title">
										<span>OA审批号<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="memberEnjoy.oaSph"
											id="oaSph" value="${memberEnjoy.oaSph}"/>
									</td>
									</tr>
									<tr>
										<td>
											<input type="hidden" name="memberEnjoy.id"
												value=${memberEnjoy.id } />
											<input type="hidden" name="memberEnjoy.createDate"
												value=${memberEnjoy.createDate } />
										</td>
									</tr>
									<tr>
                                    <td>
                                      <input type="hidden" name="memberEnjoy.subComName" id="subComName"/>
                                    </td>
                                    <td>
                                      <input type="hidden" name="memberEnjoy.subCityName" id="subCityName"/>
                                    </td>
                                  </tr>
								</table>
							</div>
							<div class="btn">
								<input type="submit" value="保存" />
								<input type="button" value="返回"
									onclick="javascript :history.back(-1);" />
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
